(library (dice-rolling)
  (export roll-die
          roll-dice)
  (import (except (rnrs base)
                  vector-for-each)
          (only (guile)
                lambda* λ
                simple-format
                current-output-port)
          ;; SRFIs
          (srfi srfi-1)
          (random)))


(define roll-die
  (lambda* (#:key
            (faces 6)
            (rand-int-gen (make-random-integer-generator #:seed #f)))
    (+ (rand-int-gen faces) 1)))


(define roll-dice
  (lambda* (count
            #:key
            (faces 6)
            (rand-int-gen (make-random-integer-generator #:seed #f)))
    (cond
     [(= count 0) '()]
     [else
      (cons (roll-die #:faces faces
                      #:rand-int-gen rand-int-gen)
            (roll-dice (- count 1)
                       #:faces faces
                       #:rand-int-gen rand-int-gen))])))
